package com.hy.Three399;

/**
 * Created With IntelliJ IDEA.
 * Descriptions:
 * User:Mr.Du
 * Date:2024/5/26
 * Time:11:57
 */
public class MaximumSumSubsequence {

    public int maximumSumSubsequence(int[] nums, int[][] queries) {
        int res = 0;
        for(int[] query : queries){
            int x = query[0], y = query[1];
            nums[x] = y;
            res = (res + rob(nums)) % 1000000007;
        }
        return res;
    }

    public int rob(int[] nums){
        int f0 = 0, f1 = 0;
        for (int x : nums) {
            int newF = Math.max(f1, (f0 + x) % 1000000007);
            f0 = f1;
            f1 = newF;
        }
        return f1 ;
    }
}
